<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
	{% include 'common-css/css.html' %}
	<title>博客列表</title>
	<style type="text/css">
		a:hover {
			text-decoration: none;
		}

		textarea {
			height: 400px;
			width: 100%;
			padding: 5px;
			border-radius: 6px;
		}

		#result {
			height: 400px;
			width: 100%;
			padding: 5px;
			border: 1px solid #999999;
			border-radius: 6px;
			word-wrap: break-word;
			overflow: auto;
		}

	</style>
</head>
<body>
<div class="div-main">
	<div>
		<div class="layui-form layui-form-pane">
			<div class="layui-row">
				<div class="layui-col-md4">
					<div class="layui-form-item">
						<label class="layui-form-label">博客标题</label>
						<div class="layui-input-inline">
							<input type="text" id="title" autocomplete="off" onkeyup="query()"
							       placeholder="请输入标题" class="layui-input">
						</div>
					</div>
				</div>
				<div class="layui-col-md4">
					<div class="layui-form-item">
						<label class="layui-form-label">选择分类</label>
						<div class="layui-input-inline">
							<select lay-verify="required" id="select_classify">
								<option value=""></option>
							</select>
						</div>
					</div>
				</div>
				<div class="layui-col-md2">
					<button class="layui-btn layui-btn-primary" id="query">查 找
						<i class="layui-icon"> &#xe615;</i>
					</button>
				</div>

				<div class="layui-col-md2">
					<button class="layui-btn layui-btn-primary" id="add_blog">新 增
						<i class="layui-icon"> &#xe654;</i>
					</button>
				</div>
			</div>
		</div>
	</div>

	<script type="text/html" id="blogtoolbar">
		<a lay-event="detail"><i class="layui-icon"> &#xe615;&nbsp;&nbsp;&nbsp;&nbsp;</i></a>
		<a lay-event="del"><i class="layui-icon"> &nbsp;&nbsp;&nbsp;&nbsp;&#xe640;</i></a>
	</script>
	<table lay-filter="blogInfo" id="blogInfoId" lay-data="{initSort:{field:'createTime', type:'desc'}}">
		<thead>
		<tr>
			<th lay-data="{field:'title', width:240}">标题</th>
			<th lay-data="{field: 'classify', width: 140}">分类</th>
			<th lay-data="{field: 'createTime', sort: true, width: 200}">创建时间</th>
			<th lay-data="{field: 'author', width: 130}">作者</th>
			<th lay-data="{field: 'status', width: 130}">状态</th>
			<th lay-data="{fixed: 'right', width: 200, align: 'center', toolbar: '#blogtoolbar'}">操作</th>
		</tr>
		</thead>
	</table>
	<div id="blogPage"></div>
</div>
<script type="text/javascript" src="{{ STATIC_URL }}js/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}layui/layui.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/blog/blog_list.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/showdown.min.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/blog/add_blog.js"></script>
</body>
</html>
<div style="padding: 10px;display: none;" id="content_details"></div>
<div class="div-main" style="display: none" id="add_blog_pane">
	<div class="layui-form layui-form-pane">
		<input type="hidden" id="blog_id">
		<div class="layui-row">
			<div class="layui-col-md4">
				<div class="layui-form-item">
					<label class="layui-form-label">博客标题</label>
					<div class="layui-input-inline">
						<input type="text" id="title_pane" autocomplete="off" placeholder="请输入标题" class="layui-input">
					</div>
				</div>
			</div>
			<div class="layui-col-md4">
				<div class="layui-form-item">
					<label class="layui-form-label">选择分类</label>
					<div class="layui-input-inline">
						<select id="select_classify_pane">
							<option value=""></option>
						</select>
					</div>
				</div>
			</div>
			<div class="layui-col-md2">
				<select lay-verify="required" id="status">
					<option value="1" selected>公开</option>
					<option value="0">草稿</option>
				</select>
			</div>
		</div>
		<div class="layui-row">
			<div class="layui-form-item">
				<form enctype="multipart/form-data" action="" method="post">
					{% csrf_token %}
					<div class="layui-col-md4">
						<input type="file" name="blog_img" id="upload_img">
					</div>
					<div class="layui-col-md8" id="upload_msg"></div>
				</form>
			</div>
		</div>
		</di
		<div class="layui-row" style="margin-top: 10px">
			<div class="layui-col-md6">
				<textarea id="oriContent" placeholder="请输入博客内容，支持markdown语法..." onkeyup="convert()"></textarea>
			</div>
			<div class="layui-col-md6">
				<div id="result"></div>
			</div>
		</div>

		<div class="layui-row layui-form" style="margin: 20px 0 20px 0">
			<div class="layui-col-md2">
				<button class="layui-btn layui-btn-primary" id="save">保存
					<i class="layui-icon">&#xe618;</i>
				</button>
			</div>
		</div>
	</div>
</div>